home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / bbs / last7_00.zip / LAST7.MEX < prev    next >
Text File  |  1996-09-22  |  6KB  |  205 lines

  1.  
  2. //////////////////////////////////////////////////////////////////////////////
  3. // File: Last7.mex
  4. // Desc: List selected number of Last callers , w/wo mail check
  5. // Copyright 1996 by Gerry Ellison.  All rights reserved.
  6. // 1:108/107.0
  7. // Free for non-commercial use
  8. // $Id: last7.mex 1.0 10/01/1996 24:00:00 gre Exp $
  9. //////////////////////////////////////////////////////////////////////////////
  10. #include <max.mh>
  11.  
  12. #define  LC_M   "\x16\x01\x5B"
  13. #define  W_M    "\x16\x01\x5F"
  14. #define  Y_M    "\x16\x01\x5E"
  15.  
  16. void checkmail() {
  17.    print(COL_LMAGENTA+strpad(" ┌",76,'═')+COL_LMAGENTA"┐\n"
  18.          " │"Y_M"░░░▒▒▒▒▒▓▓▓▓▓████████          MAXIMUS"
  19.          "  MAIL         ████████▓▓▓▓▓▒▒▒▒▒░░░"COL_LMAGENTA"│\n"+
  20.          strpad(" ├",76,'─')+COL_LMAGENTA"┤","\n"
  21.          " └─"COL_LGREEN"         Checking for mail........        "
  22.          COL_LRED"<CTRL><C> will abort...       "COL_LMAGENTA"─┘\n"
  23.          "   "); menu_cmd(418,"");  //check mail
  24. } //end check mail
  25.  
  26. Void drawheader() {
  27.    string: comment, bbs;
  28.           //" string must be exactly 38 chars long."
  29.       bbs :=" T H E  M O U N T A I N  T O P  B B S "; // bbs name 38 chars.
  30.       // change comments if you want but KEEP the length.
  31.   if (usr.priv < 60)
  32.       comment := "--=[   For Additional Time see Main Menu.   ]=--";
  33.     else
  34.       comment := "--=[         Thanks for your support!.      ]=--";
  35.  
  36.  print(COL_LMAGENTA+strpad(" ┌",76,'═')+"┐\n"+
  37.    " │"LC_M"░░░░░░"LC_M+AVATAR_BLINK"▒▒▒░"LC_M+AVATAR_BLINK"░▒▓█▓▒░"W_M" "+
  38.    bbs+" "LC_M+AVATAR_BLINK"░▒▓█▓▒░"LC_M+AVATAR_BLINK"░▒▒▒"LC_M"░░░░░░"
  39.    COL_LMAGENTA"│\n"
  40.    " │"W_M+strpad(" ",13,' ')+strpad(comment,61,' ')+COL_LMAGENTA"│\n"+
  41.    strpad(" ├",76,'─')+"┤\n"
  42.    " │ "COL_WHITE"L  #   Login  For  Access    Caller's Name         City, State      Calls"COL_LMAGENTA"│\n"
  43.    " ├"COL_CYAN+strpad("─",74,'─')+COL_LMAGENTA"┤\n");
  44. } //end draw header
  45.  
  46. int main(string: choice) { //Begin Main Program
  47. //int main(string: choice , int: limit) { //Begin Main Program
  48.  
  49.   int   : ct, limit;
  50.   string: log_in, on_for, priv;
  51.   char  : nonstop;
  52.   long  : calls, pos;
  53.  
  54.   if (choice = "" or strlower(choice) = "lu") { //begin luser
  55.   struct _callinfo: ci;
  56.   id.instant_video := 0;
  57.  
  58.   if (strlower(choice) = "lu") {
  59.       limit :=15;        // can be any length
  60.       print("\f");
  61.       }
  62.     else {
  63.       limit := 7;        // number of users to show
  64.       print("\f\n");
  65.       }
  66.  
  67.   if (call_open())
  68.   {
  69.    calls := call_numrecs();
  70.    reset_more(nonstop);
  71.  
  72.    drawheader();
  73.  
  74.    for (pos := calls -1; pos >= 0 AND call_read(pos, ci)
  75.    AND do_more(nonstop,COL_CYAN); pos := pos -1)
  76.  
  77.   { //begin array of selected names to not show.
  78.   // add as many names as you want BUT adjust the ARRAY, and FOR top limits.
  79.  
  80.    int: i;
  81.    array [0..2] of string: no;
  82.  
  83.       no[0] := "Gerry Ellison";
  84.       no[1] := "Gerald Ellison";
  85.       no[2] := "John Doe";
  86.  
  87.       for (i := 0; i <= 2; i := i + 1)
  88.       if (strlower(ci.name) = strlower(no[i]))
  89.           goto noshow;
  90.  
  91.   if (ci.flags & CALL_LOGON) { //begin list of names.
  92.  
  93.  { //begin priv. check.
  94.    int: i;
  95.    array [0..90] of string: privil;
  96.  
  97.       privil[0]  := " -Twit-";
  98.       privil[10] := "Vistor ";
  99.       privil[20] := "-Guest-";
  100.       privil[30] := "Regular";
  101.       privil[40] := "Special";
  102.       privil[50] := "VtSysOp";
  103.       privil[60] := "-=VIP=-";
  104.       privil[70] := "-=VIP=-";
  105.       privil[80] := "-=VIP=-";
  106.       privil[90] := "-SysOp-";
  107.  
  108.       for (i := 0; i <= 90; i := i + 10)
  109.            if (ci.logoff_priv = i)
  110.                priv := privil[i];
  111.  } //end priv. check.
  112.  
  113.  { //begin log_in.
  114.    int: hour_on, hour_off;
  115.  
  116.    hour_on:= strtoi(substr(stamp_string(ci.login),11,2));
  117.    if (hour_on > 11) {
  118.        hour_on:= hour_on-12;
  119.        log_in:= itostr(hour_on)+substr(stamp_string(ci.login),13,3)+"p";
  120.        }
  121.      else
  122.        log_in:= itostr(hour_on)+substr(stamp_string(ci.login),13,3)+"a";
  123.  
  124.    if (hour_on < 10)
  125.        log_in:= " "+log_in;
  126.  } //end log_in.
  127.  
  128.  { //begin on_for
  129.    int: min_on, min_off, sec_on, sec_off;
  130.  
  131.    min_on  := strtoi(substr(stamp_string(ci.login),14,2));
  132.    min_off := strtoi(substr(stamp_string(ci.logoff),14,2));
  133.  
  134.    if (min_on <= min_off)
  135.        min_on := min_off - min_on;
  136.      else
  137.        min_on := (60 - min_on) + min_off;
  138.  
  139.    sec_on  := strtoi(substr(stamp_string(ci.login),17,2));
  140.    sec_off := strtoi(substr(stamp_string(ci.logoff),17,2));
  141.  
  142.    if (sec_on <= sec_off)
  143.        sec_on := sec_off - sec_on;
  144.      else
  145.        sec_on := (60 - sec_on) + sec_off;
  146.    if (sec_on > 59) {
  147.        sec_on := sec_on - 60;
  148.        min_on := min_on + 1;
  149.        }
  150.  
  151.    if (sec_on <10)
  152.        on_for := strpadleft(itostr(min_on),2,' ')+":0"+itostr(sec_on);
  153.      else
  154.        on_for := strpadleft(itostr(min_on),2,' ')+":"+itostr(sec_on);
  155.  
  156.    if (min_on > -1 or min_on <= 9)
  157.        on_for := " "+on_for;
  158.  } //end on_for.
  159.  
  160.  { //begin data
  161.  print(COL_LMAGENTA" │"
  162.        COL_MAGENTA+  strpadleft(strpad(itostr(ci.task),2,' '),3,' ')+
  163.        COL_LGREEN+   strpadleft(strpad(itostr(ct+1),3,' '),4,' ')+
  164.        COL_LMAGENTA+ log_in+
  165.        COL_LRED+     on_for+
  166.        COL_LGREEN+   strpadleft(strpad(priv,8,' '),9,' ')+
  167.        COL_YELLOW+   strpadleft(strpad(substr(ci.name,1,20),20,' '),1,' ')+
  168.        COL_LCYAN+    substr(strpad(substr(ci.city,1,stridx(ci.city,1,',')),18,' '),1,18)+
  169.                      substr(ci.city,1+stridx(ci.city,1,','),3)+
  170.        COL_RED+      strpadleft(strpad(itostr(ci.calls),4,' '),5,' ')+
  171.        COL_LMAGENTA"│\n");
  172.        } //end data
  173.  
  174.        ct := ct + 1;
  175.    } //end not show.
  176. noshow:
  177.      if (ct >= limit) goto out;
  178.  
  179.  } // end list of names.
  180. out:
  181.       call_close();
  182.       print(strpad(" ╚",76,'═')+"╝\n");
  183.  
  184.    if (strlower(choice) = "lu") { //if last user
  185.        menu_cmd(106,"");  // enter
  186.        return 0;
  187.        }
  188.      else
  189.        sleep(50);         // pause
  190.  
  191.      }
  192.  } //end lu
  193.  
  194.    if (choice = "" or strlower(choice) = "ml") { //begin mail
  195.        if (strlower(choice) = "ml")
  196.            print("\f");
  197.  
  198.        checkmail();
  199.  
  200.    } //end mail
  201.  
  202.   return 0;
  203.  
  204. } //end main program
  205.